package commonwebgroup.commonwebartifact;

import commonwebgroup.commonwebartifact.CommandHandle.CommandCenterHandle;
import commonwebgroup.commonwebartifact.EventHandle.PlayerInteractEventHandle;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;


public final class CommonWebArtifact extends JavaPlugin {
    private FileConfiguration config;
    @Override
    public void onEnable() {
        // Plugin startup logic

        // 注册命令处理器
        getCommand("mcm").setExecutor(new CommandCenterHandle(this));
        getCommand("mcm").setTabCompleter(new CommandCenterHandle(this));
        getServer().getPluginManager().registerEvents(new PlayerInteractEventHandle(), this);

        // 注册事件监听器
        //getServer().getPluginManager().registerEvents(new ChestListener(), this);
        // 读取配置文件
        saveDefaultConfig ();
        config = getConfig();
        getLogger().info("【通用Web官网辅助插件加载成功】");
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    public void reloadPluginConfig() {
        reloadConfig();
        config = getConfig();
    }
}
